"""项目配置文件"""

import os.path

# 项目根路径
BASE_PATH = os.path.dirname(os.path.dirname(__file__))

# 存储用户数据文件夹路径
USERDATA_PATH = os.path.join(BASE_PATH, 'db', 'userdata')

# 存储日志文件路径
LOG_PATH = os.path.join(BASE_PATH, 'log', 'atm.log')

# 存储手机文件路径
PHONE_PATH = os.path.join(BASE_PATH, 'db', 'phone.json')

# logging模块配置字典
CONFIG_DICT = {
    'version': 1,
    'formatters': {
        'simple': {
            'format': '%(levelname)s - %(name)s - %(message)s',
        },
        'standard': {
            'format': '%(asctime)s - %(levelname)s - %(name)s - %(message)s - '
                      '%(filename)s - %(lineno)d - %(funcName)s - '
                      '%(process)d - %(processName)s - '
                      '%(thread)d - %(threadName)s',
        },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'level': 'DEBUG',
            'formatter': 'simple',
        },
        'file': {
            'class': 'logging.handlers.RotatingFileHandler',
            'level': 'INFO',
            'formatter': 'standard',
            'filename': LOG_PATH,
            'maxBytes': 1024 * 1024 * 5,
            'backupCount': 5,
            'encoding': 'utf-8',
        },
    },
    'filters': {},
    'loggers': {
        '': {
            'handlers': ['console', 'file'],
            'level': 'DEBUG',
            'propagate': False,
        },
    },
    'disable_existing_loggers': False,
}

if __name__ == '__main__':
    print(BASE_PATH)
    print(__doc__)
